//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standart Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#ifndef _UX_TYPE_ID_H
#define _UX_TYPE_ID_H

#pragma once

#include "../BaseTypes/Types.h"

namespace UX_STL
{
namespace UXTypes
{
	
	//
	// Type ID
	//

	namespace _types_hidden_
	{
		struct _TypeID
		{
		private:
			usize	_value;

		public:
			_TypeID () : _value(0) {}

			bool operator == (_TypeID right) const	{ return _value == right._value; }
			bool operator != (_TypeID right) const	{ return _value != right._value; }
			bool operator >  (_TypeID right) const	{ return _value >  right._value; }
			bool operator <  (_TypeID right) const	{ return _value <  right._value; }
			bool operator >= (_TypeID right) const	{ return _value >= right._value; }
			bool operator <= (_TypeID right) const	{ return _value <= right._value; }
		};


		template <typename T>
		struct _TypeId
		{
			static _TypeID  Get ()
			{
				static usize id = (usize) &id;
				return (_TypeID const &) id;
			}
		};

	}	// _types_hidden_


	typedef _types_hidden_::_TypeID		TypeId_t;


	template <typename T>
	static TypeId_t  TypeId ()
	{
		return _types_hidden_::_TypeId<T>::Get();
	}

	template <typename T>
	static TypeId_t  TypeIdOf (const T&)
	{
		return TypeId<T>();
	}

	
}	// UXTypes
}	// UX_STL

#endif	// _UX_TYPE_ID_H